//FormPanel 查询页面

Ext.DataSearchForm =  Ext.extend( Ext.form.FormPanel,{
	initialized:false,
	loadData:function(){
	this.store.load();
},
    initComponent:function(){
	this.labelAlign = 'right', //label右对齐，紧贴着文本框
	this.labelWidth = 100,
	this.title = '项目信息查询',
	this.url = 'dataManage/dataManageAction!conditionQuery'
	this.items = [{
		layout: 'Column',
		items: [{
			columnWidth:.7,
			xtype:'fieldset',
			checkboxToggle:true,
			title: '搜索条件',
			autoHeight:true,
			defaults: {width: 300},
			defaultType: 'textfield',
			items: [{
				xtype: 'numberfield',
				fieldLabel: '项目编号',
				name:'projectNumber'
			},{
				xtype:"combo",
				fieldLabel: '查询字段',
//				hiddenId: 'keyWordType',
				id: 'keyWordType',
				name: 'combo',
				editable: false,
				allowBlank: false,
				blankText: '请选择查询字段！',
				triggerAction: 'all', //query会使用autocomplete功能，会隐藏不匹配的信息
				store: new Ext.data.SimpleStore({
					fields:['keyWordType','text'],
					data:[
					      ['projectName','项目名称'],
					      ['location','所在地'],
					      ['mainUndertakeUnit','主承担单位'],
					      ['guaranteeUnit','保证单位'],
					      ['unitedUnitOne','联合单位'],
					      ['mainManagingDepartment','主管处室'],
					      ['followUpPerson','跟进人'],
					      ['projectPlanCatagory','项目计划类别'],
					      ['field','领域'],
					     ]
				}),
				displayField: 'text',
				valueField: 'keyWordType',
				mode: 'local',
				emptyText: '请选择',
			},{
				fieldLabel: '请输入关键字',
				id: 'keyWord',
				allowBlank: false,
				blankText: '请输入关键字！',
				emptyText: '关键字',
				maxLength: 200
			},{
				xtype : 'fieldset',
                fieldLabel: '选择立项年度范围',
                title: '时间',
                collapsible : true,
//              layout: 'column',
                items: [{
				     xtype: 'datefield',
				     fieldLabel: '开始日期',
				     width: 150,
				     name:'contractBegin'
			    },{
				     xtype: 'datefield',
				     fieldLabel: '结束日期', 
				     width: 150,
				     name:'contractEnd'
			    }],
			},{
				xtype : 'fieldset',
                title :'排序',
                collapsible : true, //可折叠
                collapseFirst : true,
                fieldLabel: '选择排序方式',
                autoHeight: true,
                defaultType: 'radio',
                hideLabels: true,
                layout: 'column',
                items: [{
                    boxLabel:'升序',
                    name:'rad',
                    inputValue:'1',
                    checked: true
                },{
                    boxLabel:'降序',
                    name:'rad',
                    inputValue:'2',
                }]
	}],
	buttons: [{
		text: '查询',
		handler: function(action,form) {
         
		 var n = contentPanel.getComponent("searchResult");
			if (!n) { // //判断是否已经打开该面板
		n = contentPanel.add( 
				 new Ext.DataManageGrid({
					 	ds:new Ext.data.Store( {
							proxy : new Ext.data.HttpProxy( {
								url : 'dataManage/dataManageAction!conditionQuery'
							}),
							reader : projectManageReader,
							pageSize : 20}),
						id:'searchResult',
						loadMask:true,
						title:'搜索结果',
						closable:true,
						tbar:[{
							fieldLable:'搜索结果'
						}],
				 })
				 );
			}
			contentPanel.setActiveTab(n);
			n.getStore().load({
				params:{
				keyWordType: Ext.getCmp('keyWordType').getValue(),
				keyWord: Ext.getCmp('keyWord').getValue()
			},
			});
			
		
		
//		contentPanel.getComponent('search').getForm().submit({
//			url:'dataManage/dataManageAction!conditionQuery',
//			method:'post',
//
//		    success:function(form,action){
//				
//		},
//		    failure:function(form,action){
//			    Ext.Msg.alert('错误','操作失败!');
//		}
//		});
	}
            }]
}]
}];
	Ext.DataSearchForm.superclass.initComponent.call(this);
}
})

	
